class Shap{
    public void draw() {
        System.out.println("画图形");
    }
}

class Sanjiao extends Shap {
    public void draw() {
        System.out.println("画三角形");
    }
}

class Fangxing extends Shap {

    public void draw() {
        System.out.println("画方形");
    }
}

class Yuanxing extends Shap {

    public void draw() {
        System.out.println("画圆形");
    }
}





public class Demo2 {


    public static void main(String[] args) {
        Shap[] shaps = {new Fangxing(), new Sanjiao(), new Yuanxing(), new Sanjiao()};

        for (Shap p : shaps) {
            p.draw();
        }
    }

}
